package com.jrh.dal;

import java.util.List;

import com.jrh.domain.entity.Label;

/**
 * 标签DAO
 * 
 * @author jasen.hsu.cn@gmail.com 2012-7-16 下午2:01:24
 */
public class LabelDao extends BaseDao<Label> {

    public LabelDao(){
        this.namespace = "jrh.single.label";
    }

    /**
     * 取得所有父标签
     * 
     * @return
     */
    @SuppressWarnings("unchecked")
    public List<Label> listParentLabel() {
        return (List<Label>) sqlMapClientTemplate.queryForList(namespace + "." + "listParentLabel");
    }

    /**
     * 根据父类code取得所有子类
     * 
     * @param parentCode 父类code
     * @return
     */
    @SuppressWarnings("unchecked")
    public List<Label> listChildLabel(String parentCode) {
        return (List<Label>) sqlMapClientTemplate.queryForList(namespace + "." + "listChildLabel", parentCode);
    }

    /**
     * 根据id获得value
     * @param id
     * @return
     */
    public String getValueById(Long id) {
		return (String) sqlMapClientTemplate.queryForObject(namespace + "." + "getValueById", id);
    }

}
